use async_std::task;
use core::time::Duration;
use task_stream::TaskStream;

pub fn start() {
    task::spawn(async {
        let stream = TaskStream::stream();
        loop {
            while let Some(task) = stream.get_task() {
                task.run();
            }
            task::sleep(Duration::from_millis(100)).await;
        }
    });
    task::spawn(async {
        loop {
            task::sleep(Duration::from_millis(100)).await;
            task_stream::tick(100);
        }
    });
}
